package book

import grails.test.GrailsUnitTestCase;
import grails.test.mixin.*
import org.junit.*

/**
 * See the API for {@link grails.test.mixin.services.ServiceUnitTestMixin} for usage instructions
 */
@TestFor(BookService)
class BookServiceTests
{
	private book.BookService testService = new book.BookService()
	private book.Book retrievedBook = testService.getStaticBook()
	private book.Book newBook = new book.Book(
		author: "Anynomous",
		category: BookCat.Science,
		description:"This is a test book",
		isbn: "ISBN 98-7654-321-0",
		language: "english",
		maxGrade: 2,
		minGrade: 1,
		title: "NoTitle"
	  )
	
	@Test
    void testServiceAuthor() 
	{
      assertEquals(newBook.author, retrievedBook.author)
    }
	
	@Test
    void testServiceCategory() 
	{
		assertEquals(newBook.category, retrievedBook.category)
	}
	
	@Test
	void testServiceDescription()
	{
		assertEquals(newBook.description, retrievedBook.description)
	}
	
	@Test
	void testServiceISBN()
	{
		assertEquals(newBook.isbn, retrievedBook.isbn)
	}
	
	@Test
	void testServiceLanguage()
	{
		assertEquals(newBook.language, retrievedBook.language)
	}
	
	@Test
	void testServiceMin()
	{
		assertEquals(newBook.minGrade, retrievedBook.minGrade)
	}
	
	@Test
	void testServiceMax()
	{
		assertEquals(newBook.maxGrade, retrievedBook.maxGrade)
	}
	
	@Test
	void testServiceTitle()
	{
		assertEquals(newBook.title, retrievedBook.title)
	}
}
